package com.zlc.workflow.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 权限资源枚举
 */
@Getter
@AllArgsConstructor
public enum AuthResEnum {


    /**
     * 权限资源类型
     */
    SEE("see","查看"),
    TRACKING("tracking","跟踪"),
    DEL("del","删除"),
    TRANSCRIPTION("transcription","转签"),
    TERMINATION("termination","终止"),
    REJECT("reject","退回"),
    DIRECT("direct","直送"),
    RESET("reset","撤回"),
    SAVE("save","保存"),
    CONTINUE("continue","跳过"),
    ADD("add","加签"),
    ADD_OPINION("addOpinion","添加意见"),
    CIRCUL("circul","传阅"),
    PRINT("print","打印"),
    NODES("nodes","备案"),
    UPLOAD("upload","附件上传"),

    ;

    private String type;
    private String desc;

    public String type(){
        return this.type;
    }

    public static AuthResEnum  getAuthRes(String type){
        AuthResEnum[] types = values();
        for(AuthResEnum resType : types){
            if(resType.type.equals(type)){
                return resType;
            }
        }
        return null;
    }

    public static int getOrder(String type){
        AuthResEnum authRes = getAuthRes(type);
        if(authRes == null){
            return 0;
        }
        return authRes.ordinal();
    }
}
